From: Jo-Philipp Wich Date: Fri, 8 Dec 2023 11:38:51 +0000 (+0100) Subject: luci-mod-network: properly reflect config state in sysfs tristates X-Git-Url: http://git.openwrt.org/%22https:/collectd.org//%22/%22https:/collectd.org/%22?a=commitdiff_plain;h=d6d4dcf240df721e85f91f4e45593f407d565c85;p=project%2Fluci.git luci-mod-network: properly reflect config state in sysfs tristates When a boolean sysfs option is forcibly set to `0` or `1` in uci, then make sure to properly reflect that choice state when rendering the widget. Right now the dropdown incorrectly reverted to "automatic" after saving but not applying the changes. Signed-off-by: Jo-Philipp Wich (cherry picked from commit 4b6b00927b4a1076ed8bf23f3a0327a335ebece5) --- diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/tools/network.js b/modules/luci-mod-network/htdocs/luci-static/resources/tools/network.js index 092bbbc14a..318373c7c7 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/tools/network.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/tools/network.js @@ -198,7 +198,7 @@ var cbiFlagTristate = form.ListValue.extend({ this.vallist[0] = sysdef ? _('automatic (enabled)') : _('automatic (disabled)'); } - return this.super('renderWidget', [section_id, option_index, cfgvalue]); + return this.super('renderWidget', [section_id, option_index, cfgvalue ? cfgvalue + '!' : null]); } });